package com.yunkeji.common.rtc;

// cd java/src/main/java/io/rtc && javac *.java
// cd java/src/main/java && java io.rtc.AccessTokenTest
class AccessTokenTest {

    public static void main(String[] args) {
        AccessToken token =
                new AccessToken(
                        "6667c387dde9bc01595b30da", "d09996869f054782b3ae8204f2f148e0", "1", "1");
        token.ExpireTime(Utils.getTimestamp() + 3600);
        token.AddPrivilege(AccessToken.Privileges.PrivSubscribeStream, 0);
        token.AddPrivilege(AccessToken.Privileges.PrivPublishStream, Utils.getTimestamp() + 3600);

        String s = token.Serialize();
        System.out.println(s);

        System.out.println(token);

        AccessToken t = AccessToken.Parse(s);
        System.out.println(t);

        System.out.println(t.Verify("app key"));
    }
}
